<?php

/**
 * viewad.php
 * @package adServer
 * @filesource
 */

/*	Close the backdoor	*/
$curPage = strtoupper($_SERVER['PHP_SELF']);
if (isset($curPage) && strpos($curPage, 'INDEX.PHP') === false)
    header('Location:./index.php');

require_once (CLASS_PATH . 'template.class.php');

$adUnitId = mysql_real_escape_string($_GET['adUnitId']);

$results = $session->getAdDetails($adUnitId);

/*	Load the page content	*/
$pageContent = new template(TEMPLATE_PATH . $nextAction . '.tpl');

$pageContent->replace('&&ADCODE&&', stripslashes($results[1]['adHtml']));

/*	Echo the page	*/
echo $pageContent->templateHtml;

?>